package com.kx.game.center.manager;

import org.apache.commons.math.random.MersenneTwister;
import org.apache.commons.math.random.RandomData;
import org.apache.commons.math.random.RandomDataImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LoginManager {

    private static Logger logger = LoggerFactory.getLogger(LoginManager.class);

    private static RandomData random = new RandomDataImpl(new MersenneTwister());

    /**
     * 自定义进制(0,1没有加入,容易与o,l混淆)
     */
    private static final char[] r = new char[]{'q', 'w', 'e', '8', 'a', 's', '2', 'd', 'z',
            'x', '9', 'c', '7', 'p', '5', 'i', 'k', '3', 'm', 'j',
            'u', 'f', 'r', '4', 'v', 'y', 'l', 't', 'n', '6', 'b', 'g', 'h'};


    public static String random()throws Exception{
        char[] buf = new char[8];
        for (int i = 0; i < 8 ; i++){
            int a = random.nextInt(0,32);
            buf[i] = r[a];
        }
        return new String(buf);
    }
}
